package cn.gok.hotelback.controller;

import cn.gok.hotelback.entity.HotelInfo;
import cn.gok.hotelback.entity.OrderReview;
import cn.gok.hotelback.service.HotelInfoService;
import cn.gok.hotelback.mapper.RoomOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/hotel")
public class HotelInfoController {
    
    @Autowired
    private HotelInfoService hotelInfoService;
    @Autowired
    private RoomOrderMapper roomOrderMapper;
    
    /**
     * 获取酒店基本信息
     */
    @GetMapping("/info")
    public HotelInfo getHotelInfo() {
        return hotelInfoService.getHotelInfo();
    }
    
    /**
     * 获取所有酒店信息
     */
    @GetMapping("/all")
    public List<HotelInfo> getAllHotelInfo() {
        return hotelInfoService.getAllHotelInfo();
    }
    
    /**
     * 获取所有酒店评价
     */
    @GetMapping("/reviews")
    public java.util.List<OrderReview> getAllHotelReviews() {
        return roomOrderMapper.selectAllReviews();
    }
    
    /**
     * 根据ID获取酒店信息
     */
    @GetMapping("/info/{id}")
    public HotelInfo getHotelInfoById(@PathVariable Integer id) {
        return hotelInfoService.getHotelInfoById(id);
    }
} 